Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

198
Visualizações
passing value from one page to another using input "type=text" element in javascript

page name 3.html

<html>
    <body>
<form action="4.html" onSubmit="cal()">
    <table>
        <tr>
            <td><input type="text" id="sen"/></td>
            <td><input type="submit" value="tap me"/></td>
        </tr>
    </table>
</form>
</body>
<script>
    function call(){
        var a = document.getElementById("sen").value;
        localStorage.setItem("a",a);
    }
</script>
</html>

page name 4.html

<html>
    <body>
        <table>
    <tr>
        <td><p id="r"></p></td>
    </tr>
</table>
</body>
<script>
    var get = localStorage.getItem('sen');
    alert(get);
    document.getElementById("r").innerHTML=get;
</script>
</html>

i am trying to pass value from 3.html to 4.html but it is passing null value. why is it passing the null value? how to resolve this error?

about 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

Looks like you have an error when calling the function onSubmit="cal()"

The defined function name is call()

Apart that you are trying to set the session with key a and retrieve it with key seen.

about 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda